#ifndef _PS2_REMOTE_CONTROL_H
#define _PS2_REMOTE_CONTROL_H

#include "system.h"

/* PS2手柄接收器的4根信号线 */
#define PS2_DATAI   HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_3)

#define PS2_DO(n)   HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, n)
#define PS2_CS(n)   HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, n)
#define PS2_CK(n)   HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, n)




typedef struct
{
  bool select;
  bool l3;
  bool r3;
  bool start;
  bool up;
  bool right;
  bool down;
  bool left;
  bool l2;
  bool r2;
  bool l1;
  bool r1;
  bool green;
  bool red;
  bool blue;
  bool pink;
  int rx;
  int ry;
  int lx;
  int ly;
} ps2_data_t;



extern ps2_data_t ps2_data;


bool ps2_is_red_mode(void);//判断是否为红灯模式

void ps2_data_refresh(void);

void ps2_mode_config(void);


void ps2_test(void);



#endif
